package org.yray.sip.handler.flow;


import lombok.extern.slf4j.Slf4j;
import org.yray.sip.base.MsgEle;
import org.yray.sip.base.SipMsg;
import org.yray.sip.handler.MessageHandler;
import org.yray.sip.rtp.sender.ISipSessionCache;
import org.yray.sip.server.SipServerContext;
import org.yray.sip.server.SipSession;
import org.yray.sip.utils.IcspBeanHolder;

import java.util.Optional;


@Slf4j
public class OK_ByeHandler extends MessageHandler {

    public static final OK_ByeHandler instance=new OK_ByeHandler();

    @Override
    public String[] handler(SipMsg sipMsg, SipServerContext ssc) {
        String callId= Optional.ofNullable(sipMsg.getMsgLine(MsgEle.CALL_ID)).map(String::trim).orElse(null);
        //这里针对于转人工的CALL_ID不要发
        SipSession sipSession= IcspBeanHolder.getBean(ISipSessionCache.class).get(callId);
        if(sipSession!=null&&sipSession.getSourceId()==null) {


        }
        return BLANK_STRINGS;
    }
}
